package com.ele.Servlet;

import com.ele.Pojo.ShopCategory;
import com.ele.Service.ShopCategoryService;
import com.ele.Service.impl.ShopCategoryServiceImpl;
import com.google.gson.Gson;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 店铺的类型,加载审核的店铺
 */
@WebServlet("/shopCategoryList")
public class ShopCategoryListServlet extends HttpServlet {
    private ShopCategoryService shopCategoryService = new ShopCategoryServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<ShopCategory> list = this.shopCategoryService.shopCategoryList();
        resp.setContentType("application/json;charset=utf-8");
        String json = new Gson().toJson(list);
        resp.getWriter().write(json);
    }
}
